import { getAreaObj } from '@/utils/util'

export const detailConfig = {
	showBtn: false,
	labelPosition: 'top',
	column: [
		{
			label: '所属区',
			prop: 'beAreaName',
			span: 8,
		},
		{
			label: '银发顾问人员',
			prop: 'adviserName',
			type: 'input',
			span: 8,
		},
		{
			label: '联系方式',
			prop: 'adviserPhone',
			type: 'input',
			span: 8,
		},
		{
			label: '咨询用户',
			prop: 'askUserName',
			type: 'input',
			span: 8,
		},
		{
			label: '联系方式',
			prop: 'askUserPhone',
			type: 'input',
			span: 8,
		},
		{
			label: '问询方式',
			prop: 'askWay',
			type: 'select',
			dicData: [
				{ label: '线上答疑', value: 1 },
				{ label: '电话沟通', value: 2 },
			],
			span: 8,
		},
		{
			label: '问询时间',
			prop: 'askTime',
			span: 8,
		},
		{
			label: '满意度评价',
			prop: 'pleasedValue',
			type: 'select',
			dicData: [
				{
					label: '满意',
					value: '1',
					type: 'success',
				},
				{
					label: '较为满意',
					value: '2',
					type: 'warning',
				},
				{
					label: '一般',
					value: '3',
					type: 'warning',
				},
				{
					label: '较差',
					value: '4',
					type: 'danger',
				},
			],
			span: 8,
		},
		{
			label: '问询内容',
			prop: 'chatMsg',
			span: 24,
		},
	],
}

export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '所属地区',
			prop: 'areas',
			type: 'AplidAreaSelect',
			span: 8,
		},
		{
			label: '银发顾问人员',
			prop: 'adviserName',
			type: 'input',
			span: 8,
		},
		{
			label: '咨询用户',
			prop: 'askUserName',
			type: 'input',
			span: 8,
		},
		{
			label: '问询方式',
			prop: 'askWay',
			type: 'select',
			dicData: [
				{ label: '线上答疑', value: 1 },
				{ label: '电话沟通', value: 2 },
			],
			span: 8,
		},
		{
			label: '问询时间',
			prop: 'askTimeBetween',
			format: 'YYYY年MM月DD日 HH:mm:ss',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			type: 'dateBetween',
			span: 8,
		},
		{
			label: '满意度评价',
			prop: 'pleasedValue',
			type: 'select',
			dicData: [
				{
					label: '满意',
					value: '1',
					type: 'success',
				},
				{
					label: '较为满意',
					value: '2',
					type: 'warning',
				},
				{
					label: '一般',
					value: '3',
					type: 'warning',
				},
				{
					label: '较差',
					value: '4',
					type: 'danger',
				},
			],
			span: 8,
		},
	],
}

export const tableConfig = {
	stripe: true,
	border: true,
	columns: [
		{ label: '所属区域', prop: 'beAreaNames' },
		{ label: '银发顾问人员', prop: 'adviserName' },
		{ label: '咨询用户', prop: 'askUserName' },
		{
			label: '问询方式',
			prop: 'askWayLabel',
		},
		{ label: '问询内容', prop: 'chatMsg' },
		{ label: '问询时间', prop: 'askTime' },
		{
			label: '问询满意度评价',
			prop: 'pleasedValue',
			custome: 'tag',
			dicData: [
				{
					label: '满意',
					value: '1',
					type: 'success',
				},
				{
					label: '较为满意',
					value: '2',
					type: 'warning',
				},
				{
					label: '一般',
					value: '3',
					type: 'warning',
				},
				{
					label: '较差',
					value: '4',
					type: 'danger',
				},
			],
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const api = {
	index: 'view_amTalkRecord_page',
	delete: 'view_amTalkRecord_del',
	export: 'view_amTalkRecord_export',
}
export const auth = {
	...api,
	mulitSet: 'mulitSet',
}
export const baseConfig = {
	pageName: '银发顾问问询记录',
	dictcodes: [],
	rowKey: 'id',
	addLabel: '新增',
	tipLabel: 'adviserName',
	exportMqTopic: '/ning/export/',
	api,
	auth,
	paramsObj: {
		isWithAuth: 1,
	},
	menuBtn: [
		{
			icon: 'detail',
			label: '详情',
			type: 'primary',
			operate: 'detail',
			auth: auth.index,
			text: true,
			show: true,
		},
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: auth.delete,
			text: true,
			show: true,
		},
	],
	beforeOnLoadFormate: async (query) => {
		return new Promise((resolve, reject) => {
			const areasObj: any = getAreaObj(query.areas, 'be')
			resolve({
				...query,
				...areasObj,
				areas: undefined,
			})
		})
	},
	dialogConfig: {
		width: '65%',
	},
	searchConfig,
	tableConfig,
	detailConfig,
}
